<html>
<head><meta charset="utf-8"><title>lint development · t-lang/project-never-type · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/259160-t-lang/project-never-type/index.html">t-lang/project-never-type</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/259160-t-lang/project-never-type/topic/lint.20development.html">lint development</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="211560412"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/259160-t-lang/project-never-type/topic/lint%20development/near/211560412" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/259160-t-lang/project-never-type/topic/lint.20development.html#211560412">(Sep 28 2020 at 22:49)</a>:</h4>
<p>Hi <span class="user-mention" data-user-id="128294">@blitzerr</span> , let's move our conversations from privmsg to here :)</p>



<a name="211560440"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/259160-t-lang/project-never-type/topic/lint%20development/near/211560440" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/259160-t-lang/project-never-type/topic/lint.20development.html#211560440">(Sep 28 2020 at 22:50)</a>:</h4>
<p><span aria-label="grinning" class="emoji emoji-1f600" role="img" title="grinning">:grinning:</span> sure thing !</p>



<a name="211560454"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/259160-t-lang/project-never-type/topic/lint%20development/near/211560454" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/259160-t-lang/project-never-type/topic/lint.20development.html#211560454">(Sep 28 2020 at 22:50)</a>:</h4>
<p>So <span class="user-mention" data-user-id="128294">@blitzerr</span> the thing is that we are considering nodes as dead if they are dead *<em>on entry</em></p>



<a name="211560490"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/259160-t-lang/project-never-type/topic/lint%20development/near/211560490" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/259160-t-lang/project-never-type/topic/lint.20development.html#211560490">(Sep 28 2020 at 22:50)</a>:</h4>
<p>but we really want dead on <strong>exit</strong></p>



<a name="211560508"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/259160-t-lang/project-never-type/topic/lint%20development/near/211560508" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/259160-t-lang/project-never-type/topic/lint.20development.html#211560508">(Sep 28 2020 at 22:50)</a>:</h4>
<p>so what we should do is in the <code>check_expr</code> function -- I forget the exact name, it's like <code>check_expr_with_Expectations_and_whatever</code></p>



<a name="211560517"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/259160-t-lang/project-never-type/topic/lint%20development/near/211560517" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/259160-t-lang/project-never-type/topic/lint.20development.html#211560517">(Sep 28 2020 at 22:50)</a>:</h4>
<p>towards the end it updates the <code>self.diverges</code> setting</p>



<a name="211560543"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/259160-t-lang/project-never-type/topic/lint%20development/near/211560543" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/259160-t-lang/project-never-type/topic/lint.20development.html#211560543">(Sep 28 2020 at 22:51)</a>:</h4>
<p>and that is the place where we want to say "if the new value is <em>diverges</em>, then this is a dead expresion" -- we should come up with a better name, something that reflects the sense of "dead on exit"</p>



<a name="211560559"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/259160-t-lang/project-never-type/topic/lint%20development/near/211560559" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/259160-t-lang/project-never-type/topic/lint.20development.html#211560559">(Sep 28 2020 at 22:51)</a>:</h4>
<p>I'm thinking "dead_or_diverging_expr" -- i.e., an expression that diverges or one that is dead to begin with</p>



<a name="211560581"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/259160-t-lang/project-never-type/topic/lint%20development/near/211560581" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/259160-t-lang/project-never-type/topic/lint.20development.html#211560581">(Sep 28 2020 at 22:51)</a>:</h4>
<p>so we can check if it is <code>DivergesAlways</code> or <code>DivergesWarned</code> or whatever and add the <code>hir_id</code> to that set if so</p>



<a name="211560679"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/259160-t-lang/project-never-type/topic/lint%20development/near/211560679" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/259160-t-lang/project-never-type/topic/lint.20development.html#211560679">(Sep 28 2020 at 22:52)</a>:</h4>
<p>That sounds reasonable.</p>



<a name="211560816"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/259160-t-lang/project-never-type/topic/lint%20development/near/211560816" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/259160-t-lang/project-never-type/topic/lint.20development.html#211560816">(Sep 28 2020 at 22:54)</a>:</h4>
<p>So, my action items as we discussed:</p>
<ol>
<li>Make the lint, allow by default so that lib-core passes.</li>
<li>Make a list of failures that libcore compilation hit and add those as new test cases.</li>
<li>extract out the before exit section into a function of its own.</li>
<li>Move the addition to the dead_nodes list in this section</li>
</ol>



<a name="211560823"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/259160-t-lang/project-never-type/topic/lint%20development/near/211560823" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/259160-t-lang/project-never-type/topic/lint.20development.html#211560823">(Sep 28 2020 at 22:54)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span></p>



<a name="211611180"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/259160-t-lang/project-never-type/topic/lint%20development/near/211611180" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/259160-t-lang/project-never-type/topic/lint.20development.html#211611180">(Sep 29 2020 at 12:03)</a>:</h4>
<p>So item 2 might be tricky, <span class="user-mention" data-user-id="128294">@blitzerr</span></p>



<a name="211611264"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/259160-t-lang/project-never-type/topic/lint%20development/near/211611264" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/259160-t-lang/project-never-type/topic/lint.20development.html#211611264">(Sep 29 2020 at 12:04)</a>:</h4>
<p>I think I would start by just using the <code>weird-exprs.rs</code> testcase -- let's see if we can get that test to be accepted</p>



<a name="211611293"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/259160-t-lang/project-never-type/topic/lint%20development/near/211611293" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/259160-t-lang/project-never-type/topic/lint.20development.html#211611293">(Sep 29 2020 at 12:04)</a>:</h4>
<p>minimizing failing tests from libcore is always hard</p>



<a name="211611550"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/259160-t-lang/project-never-type/topic/lint%20development/near/211611550" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/259160-t-lang/project-never-type/topic/lint.20development.html#211611550">(Sep 29 2020 at 12:07)</a>:</h4>
<p>that said, it would be good to have a test that we know reflects this case in real code, so we can be sure we've addressed it</p>



<a name="211614351"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/259160-t-lang/project-never-type/topic/lint%20development/near/211614351" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/259160-t-lang/project-never-type/topic/lint.20development.html#211614351">(Sep 29 2020 at 12:36)</a>:</h4>
<p>Sounds good <span class="user-mention" data-user-id="116009">@nikomatsakis</span>. will try to get the other points in the list.</p>



<a name="211616147"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/259160-t-lang/project-never-type/topic/lint%20development/near/211616147" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/259160-t-lang/project-never-type/topic/lint.20development.html#211616147">(Sep 29 2020 at 12:55)</a>:</h4>
<p>my hunch <span class="user-mention" data-user-id="128294">@blitzerr</span> is that the weird-exprs test, once it works, will also fix the libcore example</p>



<a name="211616439"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/259160-t-lang/project-never-type/topic/lint%20development/near/211616439" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/259160-t-lang/project-never-type/topic/lint.20development.html#211616439">(Sep 29 2020 at 12:57)</a>:</h4>
<p>That makes sense. <span class="user-mention" data-user-id="116009">@nikomatsakis</span> hopefully adding to dead_nodes towards the end will fix it all <span aria-label="grinning" class="emoji emoji-1f600" role="img" title="grinning">:grinning:</span></p>



<a name="211710291"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/259160-t-lang/project-never-type/topic/lint%20development/near/211710291" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/259160-t-lang/project-never-type/topic/lint.20development.html#211710291">(Sep 30 2020 at 03:05)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> So,<br>
I added this line:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="w">         </span><span class="c1">// Any expression that produces a value of type `!` must have diverged</span>
<span class="w">         </span><span class="k">if</span><span class="w"> </span><span class="n">ty</span><span class="p">.</span><span class="n">is_never</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">             </span><span class="bp">self</span><span class="p">.</span><span class="n">diverges</span><span class="p">.</span><span class="n">set</span><span class="p">(</span><span class="bp">self</span><span class="p">.</span><span class="n">diverges</span><span class="p">.</span><span class="n">get</span><span class="p">()</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">Diverges</span>::<span class="n">always</span><span class="p">(</span><span class="n">expr</span><span class="p">.</span><span class="n">span</span><span class="p">));</span><span class="w"></span>
<span class="o">+</span><span class="w">            </span><span class="bp">self</span><span class="p">.</span><span class="n">dead_nodes</span><span class="p">.</span><span class="n">borrow_mut</span><span class="p">().</span><span class="n">insert</span><span class="p">(</span><span class="n">expr</span><span class="p">.</span><span class="n">hir_id</span><span class="p">);</span><span class="w"></span>
<span class="w">         </span><span class="p">}</span><span class="w"></span>
</code></pre></div>

<p>Al all tests now started to fail <span aria-label="stuck out tongue" class="emoji emoji-1f61b" role="img" title="stuck out tongue">:stuck_out_tongue:</span></p>



<a name="211710361"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/259160-t-lang/project-never-type/topic/lint%20development/near/211710361" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/259160-t-lang/project-never-type/topic/lint.20development.html#211710361">(Sep 30 2020 at 03:06)</a>:</h4>
<p>Its inside func <code>check_expr_with_expectation</code> in file <code>expr.rs</code>.</p>



<a name="211776650"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/259160-t-lang/project-never-type/topic/lint%20development/near/211776650" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/259160-t-lang/project-never-type/topic/lint.20development.html#211776650">(Sep 30 2020 at 15:23)</a>:</h4>
<p><span class="user-mention" data-user-id="128294">@blitzerr</span> that is the wrong line :)</p>



<a name="211776731"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/259160-t-lang/project-never-type/topic/lint%20development/near/211776731" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/259160-t-lang/project-never-type/topic/lint.20development.html#211776731">(Sep 30 2020 at 15:23)</a>:</h4>
<p>also, can you link to where you added it...</p>



<a name="211778576"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/259160-t-lang/project-never-type/topic/lint%20development/near/211778576" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/259160-t-lang/project-never-type/topic/lint.20development.html#211778576">(Sep 30 2020 at 15:35)</a>:</h4>
<p>lol ! Let me send my changes upstream so that you have the exact line.</p>



<a name="211778943"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/259160-t-lang/project-never-type/topic/lint%20development/near/211778943" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/259160-t-lang/project-never-type/topic/lint.20development.html#211778943">(Sep 30 2020 at 15:37)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>  Its <a href="https://github.com/rust-lang/rust/pull/74535/files#diff-635b28f19e86863f9d886d3b9a7beaa7R207">this one</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>